package com.hsogoo.study.spring.propertysource;

import java.util.Map;
import java.util.Properties;

import org.junit.Test;
import org.springframework.core.env.MapPropertySource;
import org.springframework.core.env.PropertiesPropertySource;

import com.google.common.collect.Maps;

/**
 * Created by za-huangsaigang on 2018/9/17.
 */
public class PropertiesPropertySourceTest {

    @Test
    public void testPropertiesPropertySource(){

        Properties properties = new Properties();
        properties.put("name", "hsogoo");
        properties.put("age", 30);

        PropertiesPropertySource source = new PropertiesPropertySource("person", properties);
        System.out.println(source.getProperty("name"));
        System.out.println(source.getProperty("age"));
        for(String s : source.getPropertyNames()){
            System.out.println("property:" + s);
        }
        System.out.println(source.containsProperty("name"));
        System.out.println(source.containsProperty("age"));
        System.out.println(source.getName());
        System.out.println(source.getSource());
    }

}
